<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'ProductType.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="<%=path%>/css/mine.css" type="text/css" rel="stylesheet">
    <link href="<%=path%>/css/custom.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<%=path%>/js/jquery-1.6.2.min.js"></script>
  <script type="text/javascript">
  function modify(value) {
		$(location).attr('href','<%=path%>/Product_AddProductType?CNameB='+value);
}

  function deltr(opp,value) {
	     $.ajax({
				cache: true,
				type: "POST",
				url:'<%=path%>/Product_deletedata?CNameB='+ value,	 
				async: false,
				error: function(request) {
				alert("发送请求失败！"+request.responseText);
				},
				success: function(data) {
				//alert("成功");
				}
				});
	    
		$(opp).parent().parent().remove();//移除当前行
	    $(location).attr('href','<%=path%>/Product_QueryType2');
		}
  
  $(function() {
	    $('#checkData1').click(function(){
		    var CNameA=$('#search_text1').val();
		    var opt="sortA";
			$(location).attr('href','<%=path%>/Product_QueryTypeByCond?CNameA='+ CNameA+'&opt='+opt);
		  });
	    $('#checkData2').click(function(){
	    	 var CNameB=$('#search_text2').val();
		    var opt="sortB";
			$(location).attr('href','<%=path%>/Product_QueryTypeByCond?CNameB='+ CNameB+'&opt='+opt);
		  });
	    
		 
		  });
  
	</script>
  </head>
  
  <body>
  <div class="div_head">
		<span> <span style="float:left">当前位置是：产品管理 》 管理产品类别</span> <span
			style="float:right;margin-right: 8px;font-weight: bold"> <a
				style="text-decoration: none" href="./admin.php?c=goods&a=showlist">【主页】</a>
		</span>
		</span>
  </div>
  <div id="sercherDiv">
					<div id="search">
					    <input type="radio" id="radio1"  > 
						<label for="search_text1">一级类别名:</label>
						<input type="text" style="width:200px;" id="search_text1" name="search_text1" /> <input type="button" id="checkData1" value="查询" />
						<input type="radio" id="radio2"  > 
						<label for="search_text2">二级类别名:</label>
						<input type="text" style="width:200px;" id="search_text2" name="search_text2" /> <input type="button" id="checkData2" value="查询" />
					</div>
  </div>
	
    <table class="table_a" id="mytable" cellSpacing="0" cellPadding="2"
		width="100%" bgColor="#ffffff" border="2" >

		<tr>

			<th scope="col" abbr="Dual 1.8">一级类别名</th>
			<th scope="col" abbr="Dual 1.8">一级类别名（英文）</th>
			<th scope="col" abbr="Dual 1.8">二级类别名</th>
			<th scope="col" abbr="Dual 1.8">二级类别名（英文）</th>
			<th scope="col" abbr="Dual 1.8">描述</th>
			<th scope="col" abbr="Dual 1.8">创建人</th>
			<th scope="col" abbr="Dual 1.8">创建时间</th>
			<th scope="col" abbr="Dual 1.8">修改人</th>
			<th scope="col" abbr="Dual 1.8">修改时间</th>
			<th scope="col" abbr="Dual 1.8">状态</th>
			<th scope="col" abbr="Dual 1.8">操作</th>
		</tr>
		<s:iterator value="#request.PTL" var="d">
			<tr onMouseover="this.style.background='#A020F0'" onmouseout ="this.style.background=''">
				<td align="center">${d.CNameA }</td>
				<td align="center">${d.CNameeA }</td>
				<td align="center">${d.CNameB }</td>
				<td align="center">${d.CNameeB }</td>
				<td align="center">${d.CDescription }</td>
				<td align="center">${d.CCreator }</td>
				<td align="center"><s:date  name="#d.CCreatetime" format="yyyy-MM-dd hh:mm:ss"/></td>
				<td align="center">${d.CModifier }</td>
				<td align="center"><s:date  name="#d.CModifytime" format="yyyy-MM-dd hh:mm:ss"/></td>
				<td align="center">
				<a id="edit" href="javascript:modify('${d.CNameB }')">修改
				</a>
				</td>
				<td align="center"><a id="delete" href="javascript:deltr(this,'${d.CNameB }')">删除</a>&nbsp;&nbsp;</td>
			</tr>
		</s:iterator>
	</table>
	<div align="center">

		<a href="<%=path%>/Product_QueryType2?currentPage=1">首页</a>
		<s:if test="#request.page.hasPrePage">
			<a
				href="<%=path%>/Product_QueryType2?currentPage=${page.currentPage-1 }">上一页</a>
		</s:if>

		<s:if test="#request.page.hasNextPage">
			<a
				href="<%=path%>/Product_QueryType2?currentPage=${page.currentPage+1 }">下一页</a>
		</s:if>

		<a href="<%=path%>/Product_QueryType2?currentPage=${page.totalPage }">尾页</a>

		<span>当前为第${page.currentPage}页,共${page.totalPage
			}页,共${page.totalCount }总记录</span>

	</div>
  </body>
</html>
